package Demo;


public class T1 {
//    单例模式---饿汉式
    public static void main(String[] args) {
        Single s1= Single.getInstance();

    }
}
class Single{
    private Single(){
    }
    private static final Single s = new Single();

    public static Single getInstance() {
//        静态只能访问静态
        return s;
    }
}
